package indi.jp.project.business.jingying.dao;

import indi.jp.project.business.jingying.pojo.po.BidsPO;
import indi.jp.project.business.jingying.pojo.po.BidsSubPO;
import indi.jp.project.business.jingying.pojo.query.BidsQuery;
import indi.jp.project.business.jingying.pojo.vo.BidsSubVO;
import indi.jp.project.business.jingying.pojo.vo.BidsVO;
import org.apache.ibatis.annotations.Mapper;

import java.sql.SQLException;
import java.util.List;

/**
 * 投标DAO
 *
 * @author jiangping
 * @date 2022/5/13
 */
@Mapper
public interface BidsDAO {

    List<BidsPO> queryList(BidsQuery query) throws SQLException;

    int queryCount(BidsQuery query) throws SQLException;

    void insert(BidsPO bidsPO) throws SQLException;

    void update(BidsPO bidsPO) throws SQLException;

    BidsPO findPoById(String id) throws SQLException;

    BidsVO findVoById(String id) throws SQLException;

    /**
     * 通过子单ID查询主单据信息
     * 另外返回的流程信息是子单的
     */
    BidsVO findMainVoBySubId(String subId) throws SQLException;

    void deleteById(String id) throws SQLException;

    void deleteSubByPid(String pId) throws SQLException;

    void insertBidsSub(BidsSubPO bidsSubPO) throws SQLException;

    List<BidsSubVO> querySubList(BidsQuery query) throws SQLException;

    int querySubCount(BidsQuery query) throws SQLException;

    /**
     * 查询子单信息
     */
    BidsSubPO findSubById(String id) throws SQLException;

    /**
     * 查询已结束的子单数量
     */
    int queryCompleteSubCount(String pId) throws SQLException;
}
